/*
 * reset.c
 *
 *  Created on: 2012-8-22
 *      Author: Administrator
 */
#include "tangoc.h"

void reset_menu()
{
	puts("\nPress a key in brackes.");
	puts("[R] Reset TP");
	puts("[E] Enable IRQ");
	puts("[D] Disable IRQ");
//	puts("[S] Show menu");
	puts("[B] Back main menu");
	puts("[X] Exit");
}

void reset()
{
	unsigned char cmd, loop = 1;

	reset_menu();
	while (loop)
	{
		printf("Input cmd: ");
		cmd = getchar();
		while (getchar() != '\n');
		switch (cmd)
		{
		case 'r':
		case 'R':
			ioctl(gdev, ENABLE_IRQ, 0);
			ioctl(gdev, RESET_TP, 0);
			break;
		case 'e':
		case 'E':
			ioctl(gdev, ENABLE_IRQ, 0);
			break;
		case 'd':
		case 'D':
			ioctl(gdev, DISABLE_IRQ, 0);
			break;
//		case 's':
//		case 'S':
//			reset_menu();
//			break;
		case 'b':
		case 'B':
			loop = 0;
			break;
		case 'x':
		case 'X':
			finish();
			break;
		}
		reset_menu();
	}
}


